Passed
Push — feature/timeline-progress-bar ( c7c754...284a58 )
by Tristan
04:01
created

lookupConstants.ts ➔ getKeyByValue   A

Complexity

Conditions 1

Size

Total Lines 4
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
1
export enum ReviewStatusId {
2
  ScreenedOut = 1,
3
  StillThinking = 2,
4
  StillIn = 3,
5
}
6
7
export type ReviewStatusName = "screened_out" | "still_thinking" | "still_in";
8
9
export enum ResponseReviewStatusId {
10
  ScreenedOut = 1,
11
  ReadyForReference = 4,
12
  ReadyToAllocate = 5,
13
  AssessmentRequired = 6,
14
  Allocated = 7,
15
  NotAvailable = 8,
16
}
17
18
export type ResponseReviewStatusName =
19
  | "screened_out"
20
  | "ready_for_reference"
21
  | "ready_to_allocate"
22
  | "assessment_required"
23
  | "allocated"
24
  | "not_available";
25
26
export type ResponseReviewStatus = {
27
  id: ResponseReviewStatusId;
28
  name: ResponseReviewStatusName;
29
};
30
31
export enum ExcludedDepartments {
32
  StrategicTalentResponse = 18,
33
}
34
35
export enum CriteriaTypeId {
36
  Essential = 1,
37
  Asset = 2,
38
}
39
40
export enum SkillTypeId {
41
  Soft = 1,
42
  Hard = 2,
43
}
44
45
export enum SkillLevelId {
46
  Basic = 1,
47
  Intermediate = 2,
48
  Advanced = 3,
49
  Expert = 4,
50
}
51
52
export enum AssessmentTypeId {
53
  NarrativeAssessment = 1,
54
  ApplicationScreeningQuestion = 2,
55
  GroupTest = 3,
56
  InformalPhoneConversation = 4,
57
  Interview = 5,
58
  OnlineExam = 6,
59
  OnSiteExam = 7,
60
  TakeHomeExam = 8,
61
  PortfolioReview = 9,
62
  ReferenceCheck = 10,
63
  SeriousGames = 11,
64
}
65
66
export const ProvinceId = {
67
  AB: 1,
68
  BC: 2,
69
  MB: 3,
70
  NL: 4,
71
  NB: 5,
72
  NS: 6,
73
  NU: 7,
74
  NT: 8,
75
  ON: 9,
76
  PE: 10,
77
  QC: 11,
78
  SK: 12,
79
  YT: 13,
80
};
81
82
export const SecurityClearanceId = {
83
  reliability: 1,
84
  secret: 2,
85
  topSecret: 3,
86
};
87
88
export const LanguageRequirementId = {
89
  english: 1,
90
  french: 2,
91
  bilingualIntermediate: 3,
92
  bilingualAdvanced: 4,
93
  englishOrFrench: 5,
94
};
95
96
export const FrequencyId = {
97
  never: 1,
98
  rarely: 2,
99
  sometimes: 3,
100
  often: 4,
101
  always: 5,
102
};
103
104
export const TravelRequirementId = {
105
  frequently: 1,
106
  available: 2,
107
  none: 3,
108
};
109
110
export const OvertimeRequirementId = {
111
  frequently: 1,
112
  available: 2,
113
  none: 3,
114
};
115
116
export const ClassificationId = {
117
  AS: 1,
118
  BI: 2,
119
  CO: 3,
120
  CR: 4,
121
  CS: 5,
122
  EC: 6,
123
  EX: 7,
124
  FO: 8,
125
  IS: 9,
126
  PC: 10,
127
  PE: 11,
128
  PM: 12,
129
  AD: 13,
130
  "EN-ENG": 14,
131
};
132
133
export const CommentTypeId = {
134
  question: 1,
135
  recommendation: 2,
136
  requiredAction: 3,
137
};
138
139
export const LocationId = {
140
  jobGeneric: "job/generic",
141
  heading: "job/heading",
142
  basicInfo: "job/basicInfo",
143
  impact: "job/impact",
144
  tasks: "job/tasks",
145
  skills: "job/skills",
146
  langRequirements: "job/langRequirements",
147
  environment: "job/environment",
148
  summary: "hr/summary",
149
  preview: "hr/preview",
150
  screeningPlan: "screeningPlan/generic",
151
  screeningPlanBuilder: "screeningPlan/builder",
152
  screeningPlanSummary: "screeningPlan/summary",
153
  screeningPlanRatings: "screeningPlan/ratings",
154
  applicantsGeneric: "applicants/generic",
155
  underConsideration: "applicants/underConsideration",
156
  optionalConsideration: "applicants/optionalConsideration",
157
  notUnderConsideration: "applicants/notUnderConsideration",
158
} as const;
159
160
export enum JobStatus {
161
  Draft = "draft",
162
  ReviewManager = "review_manager",
163
  ReviewHr = "review_hr",
164
  Translation = "translation",
165
  FinalReviewManager = "final_review_manager",
166
  FinalReviewHr = "final_review_hr",
167
  PendingApproval = "pending_approval",
168
  Approved = "approved",
169
  Ready = "ready",
170
  Live = "live",
171
  Assessment = "assessment",
172
  Completed = "completed",
173
}
174
175
export enum ResponseScreeningBuckets {
176
  Consideration = "consideration",
177
  ReadyToAllocate = "ready_to_allocate",
178
  Allocated = "allocated",
179
  Unavailable = "unavailable",
180
  DoesNotQualify = "does_not_qualify",
181
}
182
183
export const CitizenshipId = {
184
  citizen: 1,
185
  permanentResident: 2,
186
  workPermitOpen: 3,
187
  workPermitClosed: 4,
188
  notEntitled: 5,
189
};
190
191
export const VeteranId = {
192
  none: 1,
193
  current: 2,
194
  past: 3,
195
};
196
197
export function getKeyByValue(object, value): string {
198
  return (
199
    Object.keys(object).find((key) => object[key] === parseInt(value, 10)) || ""
200
  );
201
}
202
203
export function enumToIds(enumType: object): number[] {
204
  const enumVals = Object.values(enumType);
205
  // Note: this first array includes the list of ids as strings, followed by the list of names as strings
206
  const enumIds = enumVals.filter((item) => !Number.isNaN(Number(item)));
207
  return enumIds.map((id) => Number(id));
208
}
209
210
export const SkillLevelIdValues = enumToIds(SkillLevelId);
211
212
export const SkillTypeIdValues = enumToIds(SkillTypeId);
213
214
export const AssessmentTypeIdValues = enumToIds(AssessmentTypeId);
215
216
export const CriteriaTypeIdValues = enumToIds(CriteriaTypeId);
217